package com.xiaolin.session.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaolin.session.mapper.MemberMapper;
import com.xiaolin.session.model.Member;
import com.xiaolin.session.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ClassName MemberServiceImpl
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/9/30
 * @Version 1.0
 */
@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    MemberMapper memberMapper;

    @Override
    public Member selectByName(String name) {
        QueryWrapper<Member> wrapper=new QueryWrapper<>();
        wrapper.eq("username",name);
        return memberMapper.selectOne(wrapper);
    }

    @Override
    public List<Member> list(Map<String, String> params) {
        return memberMapper.selectList(null);
    }

    @Override
    public int save(Member member) {
        return memberMapper.insert(member);
    }
}
